// 学生获取自己的成绩

import axios from "axios";

export default function () {
    return axios({
        method: "get",
        url: "/api/students/score",
        header: {
            Authorization: localStorage.getItem("Authorization")
        }
    }).then(response => {
        // 对数据做一下预处理，加个key
        let scores = response.data.scores;
        for (let i = 0; i < scores.length; i++) {
            scores[i].key = i;
        }
        return {
            result: true,
            data: response.data
        }
    }).catch(error => {
        return {
            result: false,
            msg: error.response.data.msg
        }
    })
}